package com.igeek.boot.controller;

import com.igeek.boot.config.LoginUser;
import com.igeek.boot.entity.Admin;
import com.igeek.boot.service.IAdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author fengqq
 * @Description TODO
 * @Date 2024/9/13  11:46
 */
@Controller
@Api(tags = "管理员模块的接口")
@RequestMapping("/admin")
@Slf4j
public class AdminController {
    @Resource
    private IAdminService adminService;
    @GetMapping("/findAll")
    @ResponseBody
    @ApiOperation("查询管理员列表")
    public List<Admin> findAll(){
        List<Admin> list = adminService.list();
        return list;
    }

    @GetMapping("/login")
    @ApiOperation("管理员登录")
    public String login(Admin admin){
        LoginUser loginUser = adminService.login(admin);
        log.info("loginUser:{}",loginUser);
        return "/hello";
    }
}
